package cn.sylinx.web.template.velocity;

import io.vertx.ext.web.templ.TemplateEngine;

public interface VelocityTemplateEngine extends TemplateEngine {

	/**
	 * Default max number of templates to cache
	 */
	int DEFAULT_MAX_CACHE_SIZE = 10000;

	/**
	 * Default template extension
	 */
	String DEFAULT_TEMPLATE_EXTENSION = "vm";

	/**
	 * The default directory where templates will be looked for
	 */
	String DEFAULT_TEMPLATE_DIRECTORY = "templates";

	/**
	 * The default content type header to be used in the response
	 */
	String DEFAULT_CONTENT_TYPE = "text/html";

	/**
	 * Create a template engine using defaults
	 *
	 * @return the engine
	 */
	static VelocityTemplateEngine create() {
		return new VelocityTemplateEngineImpl();
	}

	static VelocityTemplateEngine createWithLayout() {
		return new VelocityLayoutTemplateEngineImpl();
	}

	/**
	 * Set the extension for the engine
	 *
	 * @param extension
	 *            the extension
	 * @return a reference to this for fluency
	 */
	VelocityTemplateEngine setExtension(String extension);

	/**
	 * Set the max cache size for the engine
	 *
	 * @param maxCacheSize
	 *            the maxCacheSize
	 * @return a reference to this for fluency
	 */
	VelocityTemplateEngine setMaxCacheSize(int maxCacheSize);

	/**
	 * TemplateDirectory
	 * 
	 * @return
	 */
	default String getTemplateDirectory() {
		return DEFAULT_TEMPLATE_DIRECTORY;
	}

	/**
	 * ContentType
	 * 
	 * @return
	 */
	default String getContentType() {
		return DEFAULT_CONTENT_TYPE;
	}
}
